package com.xfcy.blog.dto;

import com.xfcy.blog.valid.AddGroup;
import com.xfcy.blog.valid.ListValue;
import com.xfcy.blog.valid.UpdateGroup;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.*;

/**
 * @author 晓风残月Lx
 * @date 2023/5/24 16:38
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DictDTO {

    @Null(message = "id应该为空", groups = AddGroup.class)
    @NotNull(message = "id不能为空", groups = UpdateGroup.class)
    private Long id;

    @NotBlank(message = "字典名称不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String name;

    @NotBlank(message = "字典类型不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String type;

    @Pattern(regexp = "^[0-1]{1}$", message = "发布状态必须为0或1")
    @NotEmpty(message = "发布状态必须提交", groups = {AddGroup.class, UpdateGroup.class})
    private String isPublish;

    private String remark;

    @Min(value = 0, message = "排序必须大于等于0", groups = {AddGroup.class, UpdateGroup.class})
    @Max(value = 9, message = "排序必须小于等于0", groups = {AddGroup.class, UpdateGroup.class})
    private Integer sort;
}
